#include<stdio.h>


int main(int argc, char const *argv[])
{
    int n,k,max=0,min=10,cout=0,temp;
    scanf("%d",&n);
    k = n;
    while (n--)
    {
        scanf("%d",&temp);
        if(temp>max) max = temp;
        if(temp<min) min = temp;
        cout += temp;
    }
    printf("%.2f",(cout-max-min)/(k-2.0));

    return 0;
}
